package com.dong.pointandviewpager.sample.activity

import android.os.Bundle
import android.widget.ImageView
import androidx.appcompat.app.AppCompatActivity
import com.dong.pointandviewpager.R
import com.dong.pointandviewpager.sample.factory.DataFactory.newDataBeans
import com.dong.pointandviewpager.sample.factory.ListenerFactory.newChangedListener
import com.dong.pointandviewpager.sample.factory.ListenerFactory.newClickListener
import com.dong.pointandviewpager.sample.model.ModelBean
import com.dong.pointviewpager.widget.LoopViewPager
import kotlinx.android.synthetic.main.activity_looper.*

class LoopActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_looper)

        //配置LoopViewPager参数
        val loopViewPager = loopViewPager as LoopViewPager<ModelBean>
        loopViewPager.run {
            setLoop(false)
            setAuto(true)
            setAutoTime(5)
            setRadius(5f)
            setImageScale(ImageView.ScaleType.FIT_XY)
            onLoopPageChangeListener = newChangedListener()
            onLoopPagerClickListener = newClickListener()
            beans = newDataBeans()
            initialise()
        }
    }
}